<@html title="文章新建页面" >
	<script type="text/javascript" src="${base}/plugins/ueditor/${ueditorVersion}/ueditor.config.js"></script>
	<script type="text/javascript" src="${base}/plugins/ueditor/${ueditorVersion}/ueditor.all.js"></script>

	<!-- Content Header (Page header) -->
	<section class="content-header">
		<h1>
        	<i class="fa fa-file-word-o"></i> &nbsp;新建文章
        	<!--<small>Article</small>-->
    	</h1>
		<ol class="breadcrumb">
			<li>
				<a href="#"><i class="fa fa-dashboard"></i> 首页</a>
			</li>
			<li>
				<a href="#">文章管理</a>
			</li>
			<li class="active">新建文章</li>
		</ol>
	</section>

	<!-- Main content -->
	<section class="content">
		<!-- general form elements -->
		<!-- form start -->
		<form id="articleForm">
			<div class="box box-info">
				<div class="box-body">
					<div class="row">
						<div class="col-md-9">
							<div class="form-group">
								<input type="hidden" name="articleId" id="articleId" value="" />
								<label for="articleTitle">标题</label>
								<input type="text" name="articleTitle" class="form-control" maxlength="500" id="articleTitle" placeholder="请输入文章标题...">
							</div>
							<!--<div class="form-group">
								<label for="inputAliasTitle">别名</label>
								<input type="text" class="form-control" maxlength="500" id="inputAliasTitle" placeholder="请输入文章标题别名...">
							</div>-->
							<div class="form-group">
								<label for="articleKeyword">标签</label>
								<input type="text" name="articleKeyword" class="form-control" maxlength="50" id="articleKeyword" placeholder="请输入归类标签...">
							</div>
							<div class="form-group">
								<script id="container" name="articleContent" type="text/plain"></script>
							</div>
						</div>
						<div class="col-md-3 form-horizontal">
							<div class="form-group">
								<label>&nbsp;</label>
								<div class="col-sm-9 col-sm-offset-3">
									<button type="button" id="saveOrUpdateBtn" class="btn btn-primary col-sm-12">提交</button>
								</div>
							</div>
							<div class="form-group">
								<label for="articleType" class="col-sm-3 control-label">分类</label>
								<div class="col-sm-9">
									<select class="form-control" name="articleType">
										<option>请选择</option>
										<#list categoryEntityList as category>
											<option value="${category.categoryId}">${category.categoryTitle}</option>
										</#list>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="articleStatus" class="col-sm-3 control-label">状态</label>
								<div class="col-sm-9">
									<select class="form-control" name="articleStatus">
										<#list sysDictEntityList as item>
											<option value="${item.sdCode}">${item.sdName}</option>
										</#list>
									</select>
								</div>
							</div>
							<!--<div class="form-group">
								<label for="articleStatus" class="col-sm-3 control-label">置顶</label>
								<div class="col-sm-9">
									<select class="form-control" name="articleStatus">
										<option>无</option>
										<option>首页</option>
										<option>分类</option>
										<option>全局</option>
									</select>
								</div>
							</div>-->
						</div>
					</div>
				</div>
				<!-- /.box-body -->
			</div>
			<!-- /.box -->
		</form>
	</section>

	<script type="text/javascript">
		var ue = UE.getEditor('container');
		$(function(){
			$("#saveOrUpdateBtn").click(function(){
			var formData = $("#articleForm").serializeJSON();
				$.ajax({
				   	type: "POST",
				   	url: "${base}/web/article/saveOrUpdate",
				   	contentType:'application/json;charset=utf-8',
            		data:JSON.stringify(formData),
//				   	data: formData,
				   	success: function(msg){
				    	alert( "Data Saved: " + msg );
				   	}
				});
			})
		});
		
	</script>
</@html>